from purest.web.resources.plainResource import PlainResource
from purest.web import status

class EnvironPrinter(PlainResource):
    """ Returns all environ entries to the client. """

    def __init__(self):
        PlainResource.__init__(self)

    def get(self, environ, start_response):
        start_response(status.OK, [('Content-Type', 'text/plain')])
        for key, value in environ.items():
            yield "{key:.<30}: {value} {value_type}\n".format(key=key, 
                value=value, value_type=type(value))
            